package com.wangshouyu.mp.user;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import com.wangshouyu.mp.base.response.BaseResponse;

import java.util.Objects;

/**
 * @author 王守钰
 * @date 2020年12月24日 09:28
 * @description 用户相应
 */
public class UserResponse extends BaseResponse {

    /**
     * 关注该公众账号的总用户数
     */
    private Long total;

    /**
     * 拉取的OPENID个数，最大值为10000
     */
    private Long count;

    /**
     * 拉取列表的最后一个用户的OPENID
     */
    @SerializedName(value = "next_openid")
    @JsonProperty(value = "next_openid")
    @JSONField(name = "next_openid")
    private String nextOpenId;

    /**
     * 列表数据，OPENID的列表
     */
    private UserList data;

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }

    public String getNextOpenId() {
        return nextOpenId;
    }

    public void setNextOpenId(String nextOpenId) {
        this.nextOpenId = nextOpenId;
    }

    public UserList getData() {
        return data;
    }

    public void setData(UserList data) {
        this.data = data;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        UserResponse that = (UserResponse) o;
        return Objects.equals(total, that.total) && Objects.equals(count, that.count) && Objects.equals(nextOpenId, that.nextOpenId) && Objects.equals(data, that.data);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), total, count, nextOpenId, data);
    }

    @Override
    public String toString() {
        return "UserResponse{" +
                "total=" + total +
                ", count=" + count +
                ", nextOpenId='" + nextOpenId + '\'' +
                ", data=" + data +
                '}';
    }
}
